home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / dosisode / DOSISODE80.ZIP / ISODE8.WRK / UNIX / H / TERMIOS.H < prev   
Encoding:
C/C++ Source or Header  |  1992-03-19  |  5.9 KB  |  236 lines

  1. /*    @(#)termios.h 1.18 89/10/04 SMI    */
  2.  
  3. #ifndef    __sys_termios_h
  4. #define    __sys_termios_h
  5.  
  6. #include <sys/stdtypes.h>
  7. #include <sys/ioccom.h>
  8. #include <sys/ttydev.h>
  9. #include <sys/ttycom.h>
  10.  
  11. #define    NCCS    17
  12.  
  13. /*
  14.  * control characters
  15.  * the following are not (yet) posix
  16.  * VEOL2, VSWTCH, VDSUSP, VREPRINT, VDISCARD, VWERASE, VLNEXT, VSTATUS
  17.  */
  18. #define    VINTR        0
  19. #define    VQUIT        1
  20. #define    VERASE        2
  21. #define    VKILL        3
  22. #define    VEOF        4
  23. #define    VEOL        5
  24. #ifndef _POSIX_SOURCE
  25. #define    VEOL2        6
  26. #define    VSWTCH        7
  27. #endif
  28. #define    VSTART        8
  29. #define    VSTOP        9
  30. #define    VSUSP        10
  31. #ifndef _POSIX_SOURCE
  32. #define    VDSUSP        11
  33. #define    VREPRINT    12
  34. #define    VDISCARD    13
  35. #define    VWERASE        14
  36. #define    VLNEXT        15
  37. #define    VSTATUS        16
  38. #endif
  39.  
  40. #define    VMIN        VEOF
  41. #define    VTIME        VEOL
  42.  
  43. #ifndef    _POSIX_SOURCE
  44. #define    _CTRL(c)    ('c'&037)
  45.  
  46. /*
  47.  * default control chars.
  48.  * guarded for ttychars.h.
  49.  */
  50. #ifndef    CINTR
  51. #define    CINTR    _CTRL(c)
  52. #define    CQUIT    034        /* FS, ^\ */
  53. #define    CERASE    0177        /* DEL, ^? */
  54. #define    CKILL    _CTRL(u)
  55. #define    CEOF    _CTRL(d)
  56. #define    CEOT    CEOF
  57. #define    CEOL    0
  58. #define    CEOL2    0
  59. #define    CSWTCH    0
  60. #define    CNSWTCH    0
  61. #define    CSTART    _CTRL(q)
  62. #define    CSTOP    _CTRL(s)
  63. #define    CSUSP    _CTRL(z)
  64. #define    CDSUSP    _CTRL(y)
  65. #define    CRPRNT    _CTRL(r)
  66. #define    CFLUSH    _CTRL(o)
  67. #define    CWERASE    _CTRL(w)
  68. #define    CLNEXT    _CTRL(v)
  69. #endif    /* !CINTR */
  70.  
  71. #define    CESC    '\\'
  72. #define    CNUL    0
  73. #define    CDEL    0377
  74. #endif    !_POSIX_SOURCE
  75.  
  76. /* input modes */
  77. #define    IGNBRK    0x00000001
  78. #define    BRKINT    0x00000002
  79. #define    IGNPAR    0x00000004
  80. #define    PARMRK    0x00000008
  81. #define    INPCK    0x00000010
  82. #define    ISTRIP    0x00000020
  83. #define    INLCR    0x00000040
  84. #define    IGNCR    0x00000080
  85. #define    ICRNL    0x00000100
  86. /*    IUCLC    0x00000200    not posix, defined below */
  87. #define    IXON    0x00000400
  88. /*    IXANY    0x00000800    not posix, defined below */
  89. #define    IXOFF    0x00001000
  90. /*    IMAXBEL    0x00002000    not posix, defined below */
  91.  
  92. #ifndef    _POSIX_SOURCE
  93. #define    IUCLC    0x00000200
  94. #define    IXANY    0x00000800
  95. #define    IMAXBEL    0x00002000
  96. #endif    /* !_POSIX_SOURCE */
  97.  
  98. /* output modes */
  99. #define    OPOST    0x00000001
  100. #ifndef    _POSIX_SOURCE
  101. #define    OLCUC    0x00000002
  102. #define    ONLCR    0x00000004
  103. #define    OCRNL    0x00000008
  104. #define    ONOCR    0x00000010
  105. #define    ONLRET    0x00000020
  106. #define    OFILL    0x00000040
  107. #define    OFDEL    0x00000080
  108. #define    NLDLY    0x00000100
  109. #define    NL0    0
  110. #define    NL1    0x00000100
  111. #define    CRDLY    0x00000600
  112. #define    CR0    0
  113. #define    CR1    0x00000200
  114. #define    CR2    0x00000400
  115. #define    CR3    0x00000600
  116. #define    TABDLY    0x00001800
  117. #define    TAB0    0
  118. #define    TAB1    0x00000800
  119. #define    TAB2    0x00001000
  120. #define    XTABS    0x00001800
  121. #define    TAB3    XTABS
  122. #define    BSDLY    0x00002000
  123. #define    BS0    0
  124. #define    BS1    0x00002000
  125. #define    VTDLY    0x00004000
  126. #define    VT0    0
  127. #define    VT1    0x00004000
  128. #define    FFDLY    0x00008000
  129. #define    FF0    0
  130. #define    FF1    0x00008000
  131. #define    PAGEOUT    0x00010000
  132. #define    WRAP    0x00020000
  133. #endif    /* !_POSIX_SOURCE */
  134.  
  135. /* control modes */
  136. #ifndef    _POSIX_SOURCE
  137. #define    CBAUD    0x0000000f
  138. #endif
  139. #define    CSIZE    0x00000030
  140. #define    CS5    0
  141. #define    CS6    0x00000010
  142. #define    CS7    0x00000020
  143. #define    CS8    0x00000030
  144. #define    CSTOPB    0x00000040
  145. #define    CREAD    0x00000080
  146. #define    PARENB    0x00000100
  147. #define    PARODD    0x00000200
  148. #define    HUPCL    0x00000400
  149. #define    CLOCAL    0x00000800
  150. #ifndef    _POSIX_SOURCE
  151. #define    LOBLK    0x00001000
  152. #define    CIBAUD    0x000f0000
  153. #define    CRTSCTS    0x80000000
  154.  
  155. #define    IBSHIFT    16
  156. #endif    /* !_POSIX_SOURCE */
  157.  
  158. /* line discipline 0 modes */
  159. #define    ISIG    0x00000001
  160. #define    ICANON    0x00000002
  161. /*    XCASE    0x00000004        not posix, defined below */
  162. #define    ECHO    0x00000008
  163. #define    ECHOE    0x00000010
  164. #define    ECHOK    0x00000020
  165. #define    ECHONL    0x00000040
  166. #define    NOFLSH    0x00000080
  167. #define    TOSTOP    0x00000100
  168. /*    ECHOCTL    0x00000200        not posix, defined below */
  169. /*    ECHOPRT    0x00000400        not posix, defined below */
  170. /*    ECHOKE    0x00000800        not posix, defined below */
  171. /*    DEFECHO    0x00001000        not posix, defined below */
  172. /*    FLUSHO    0x00002000        not posix, defined below */
  173. /*    PENDIN    0x00004000        not posix, defined below */
  174. #define    IEXTEN    0x00008000
  175.  
  176. #ifndef    _POSIX_SOURCE
  177. #define    XCASE    0x00000004
  178. #define    ECHOCTL    0x00000200
  179. #define    ECHOPRT    0x00000400
  180. #define    ECHOKE    0x00000800
  181. #define    DEFECHO    0x00001000
  182. #define    FLUSHO    0x00002000
  183. #define    PENDIN    0x00004000
  184. #endif    /* !_POSIX_SOURCE */
  185.  
  186. #ifndef    _POSIX_SOURCE
  187. /*
  188.  * codes 1 through 5, not shown here, are old "termio" calls
  189.  */
  190. #define    TCXONC        _IO(T, 6)
  191. #define    TCFLSH        _IO(T, 7)
  192. #define    TCGETS        _IOR(T, 8, struct termios)
  193. #define    TCSETS        _IOW(T, 9, struct termios)
  194. #define    TCSETSW        _IOW(T, 10, struct termios)
  195. #define    TCSETSF        _IOW(T, 11, struct termios)
  196. #endif    /* !_POSIX_SOURCE */
  197.  
  198. #define    TCOOFF        0        /* arg to TCXONC & tcflow() */
  199. #define    TCOON        1        /* arg to TCXONC & tcflow() */
  200. #define    TCIOFF        2        /* arg to TCXONC & tcflow() */
  201. #define    TCION        3        /* arg to TCXONC & tcflow() */
  202. #define    TCIFLUSH    0        /* arg to TCFLSH & tcflush() */
  203. #define    TCOFLUSH    1        /* arg to TCFLSH & tcflush() */
  204. #define    TCIOFLUSH    2        /* arg to TCFLSH & tcflush() */
  205. #define    TCSANOW        0        /* arg to tcsetattr() */
  206. #define    TCSADRAIN    1        /* arg to tcsetattr() */
  207. #define    TCSAFLUSH    2        /* arg to tcsetattr() */
  208.  
  209. /*
  210.  * Ioctl control packet
  211.  */
  212. struct    termios {
  213.     tcflag_t    c_iflag;    /* input modes */
  214.     tcflag_t    c_oflag;    /* output modes */
  215.     tcflag_t    c_cflag;    /* control modes */
  216.     tcflag_t    c_lflag;    /* line discipline modes */
  217.     char        c_line;        /* line discipline XXX */
  218.     cc_t        c_cc[NCCS];    /* control chars */
  219. };
  220.  
  221.  
  222. #ifndef    KERNEL
  223. speed_t    cfgetispeed(/* struct termios *termios_p */);
  224. speed_t    cfgetospeed(/* struct termios *termios_p */);
  225. int    cfsetispeed(/* struct termios *termios_p, speed_t speed */);
  226. int    cfsetospeed(/* struct termios *termios_p, speed_t speed */);
  227. int    tcdrain(/* int fildes */);
  228. int    tcflow(/* int fildes, int action */);
  229. int    tcflush(/* int fildes, int queue_selector */);
  230. int    tcgetattr(/* int fildes, struct termios *termios_p */);
  231. int    tcsendbreak(/* int fildes, int duration */);
  232. int    tcsetattr(/* int fildes, int optional_actions, struct *termios_p */);
  233. #endif    /* !KERNEL */
  234.  
  235. #endif    /* !__sys_termios_h */
  236.